<?php
	class mtrangthai extends connect_db{
		protected $_tt;
		
		public function settt($tt){
			$this->_tt = $tt;
		}
		public function gettt(){
			return $this->_tt;
		}
	
		public function __construct(){
			$this->connect();
		}
		public function show(){
			$sql = "select * from loaitrangthai order by loaitt_id DESC";
			$this->query($sql);
			if($this->num_rows() == 0){
				return false;
			}else{
				while($row = $this->fetch()){
					$data[] = $row;
				}
				return $data;
			}
		}
		public function add(){
			$sql = "insert into loaitrangthai(tentt) values('".$this->gettt()."')";
			$this->query($sql);
		}
		public function del($id){
			$sql = "delete from loaitrangthai where loaitt_id='$id'";
			$this->query($sql);
		}
		public function get($id){
			$sql = "select * from loaitrangthai where loaitt_id='$id'";
			$this->query($sql);
			return $this->fetch();
		}
		public function edit($id){
			$sql="update loaitrangthai set tentt='".$this->gettt()."' where loaitt_id='$id'";
			$this->query($sql);
		}
	}
?>